/*
 * @(#)MaintForumGroupForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.forum.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.forum.bean.ForumGroup;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;

/**
  MaintForumGroupForm.java

  This class is the for web form purpose.

  @author      Zoe Shum
  @company     DCIVision Limited
  @creation date   15/10/2003
  @version     $Revision: 1.3 $
*/

public class MaintForumGroupForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.3 $";

  private String parentID = null;
  private String groupName = null;
  private String description = null;

  public MaintForumGroupForm() {
    super();
  }

  public String getParentID() { 
    return(this.parentID);
  }

  public void setParentID(String parentID) { 
    this.parentID = parentID;
  }

  public String getGroupName() { 
    return(this.groupName);
  }

  public void setGroupName(String groupName) { 
    this.groupName = groupName;
  }

  public String getDescription() { 
    return(this.description);
  }

  public void setDescription(String description) { 
    this.description = description;
  }
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setParentID(null);
    this.setGroupName(null);
    this.setDescription(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    ForumGroup tmpForumGroup = new ForumGroup();
    tmpForumGroup.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpForumGroup.setParentID(TextUtility.parseIntegerObj(this.getParentID()));
    tmpForumGroup.setGroupName(this.getGroupName());
    tmpForumGroup.setDescription(this.getDescription());
    tmpForumGroup.setRecordStatus(this.getRecordStatus());
    tmpForumGroup.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpForumGroup.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpForumGroup.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpForumGroup.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpForumGroup.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpForumGroup;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    ForumGroup tmpForumGroup = (ForumGroup)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpForumGroup.getID()));
    this.setParentID(TextUtility.formatIntegerObj(tmpForumGroup.getParentID()));
    this.setGroupName(tmpForumGroup.getGroupName());
    this.setDescription(tmpForumGroup.getDescription());
    this.setRecordStatus(tmpForumGroup.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpForumGroup.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpForumGroup.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpForumGroup.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpForumGroup.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpForumGroup.getUpdateDate()));
  }
}
